
function request(url, data = "", type = "get") {
    return new Promise(function (resolve) {
        $.ajax({
            type,
            url,
            data,
            dataType: "json",
            success: function (result) {
                resolve(result);
            }
        })
    })
}
const isExistUser = params => request("../php/isExistUser.php", params, "get");
const isExistPhone = params => request("../php/isExistPhone.php", params, "get");
const isExistEmail = params => request("../php/isExistEmail.php", params, "get");

const register = params => request("../php/register.php", params, "post");
const login = params => request("../php/login.php", params, "post");


//删除
const deleteGradeById = params => request("../php/deleteGradeById.php", params);
//编辑按钮
const searchGradeById = params => request("../php/searchGradeById.php", params);
//确定按钮
const updateGradeById = params => request("../php/updateGradeById.php", params);


//商品列表
const searchGoodsOrderLimit = params => request("../php/searchGoodsOrderLimit.php", params);
//详情页
const addToShoppingCar = params => request("../php/addToShoppingCar.php", params, "post");
const searchGoodsByGoodsId = params => request("../php/searchGoodsByGoodsId.php", params);

// 购物车
const searchShoppingCarByUser = params => request("../php/searchShoppingCarByUser.php", params, "post");

const deleteShoppingCarById = params => request("../php/deleteShoppingCarById.php", params);
const updateShoppingCarById = params => request("../php/updateShoppingCarById.php", params);



